package com.mycode.mediator18.resolve;

public class ConcreteMediator extends Mediator{

    public Button addButton;
    public List list;
    public TextBox userNameTextBox;
    public ComboBox comboBox;

    @Override
    public void componentChanged(Component component) {
        if (component == addButton) {
            System.out.println("-- 单击增加按钮 --");
            list.update();
            comboBox.update();
            userNameTextBox.update();
        }
        else if (component == list) {
            System.out.println("-- 从列表框选择客户 --");
            comboBox.select();
            userNameTextBox.setText();
        }
        else if (component == comboBox) {
            System.out.println("-- 从组合框选择客户 --");
            comboBox.select();
            userNameTextBox.setText();
        }
    }
}
